arcgis for flex 交接

1.项目代码

2.开发工具

  • FlashBuilder_4_6_LS10.exe

    ide ,基于eclipse 系列
    
  • flashplayer_22_ax_debug.exe

    flash 运行需要的调试插件,运行只需安装flash player
    

备注:ide 自身不携带svn 插件

3.flex语言开发中涉及的文件类型

  • .as 文件(相当于js)

    语法上风格,在java基础上融入了js 。
  • .mxml 文件 (相当于html)

  • .xml 文件 (参数配置文件)

  • .swf .swz 文件

    .mxml 编译后的文件,可以理解为 java .class 文件

4 flex 项目目录

image

5 flex地图开发框架的介绍

1.FlexMap viewr 目录

image

2. index.mxml 代码的入口

3. config.xml 地图的配置文件。中心点,图层以及一些widgets 的加载配置

维护flex 过程中写as 文件比较多。基本不需要用到flex 皮肤的知识。

6 重要代码片段

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0" ?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Read more about ArcGIS Viewer for Flex - http://links.esri.com/flexviewer
//
////////////////////////////////////////////////////////////////////////////////
-->
<configuration>
<title>ArcGIS Viewer for Flex</title>
<subtitle>a configurable web mapping application</subtitle>
<logo>assets/images/logo.png</logo>
<!-- <clientUrl>plugin/gis/</clientUrl> -->
<style>
<colors>0xFFFFFF,0x333333,0x101010,0x000000,0xFFD700</colors>
<alpha>0.8</alpha>
<font name="Microsoft YaHei"></font>
<titleFont name="Microsoft YaHei"></titleFont>
<subTitleFont name="Microsoft YaHei"></subTitleFont>
</style>
<!-- replace the following url with your own geometryservice -->
<geometryservice url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" />
<!-- UI elements -->
<widget left="10" top="10" config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/NavigationSimpleWidget.swf"/>
<widget right="10" top="10" config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/SimpleMapSwitcherWidget.swf"/>
<widget right="0" bottom="0" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/>
<widget left="6" bottom="0" config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/MapMouseWidget.swf"/>
<!-- <widget left="0" top="0" config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"> -->
<map wraparound180="false" regionChange="true" initialextent="110.16801,22.2574,116.9246,25.2187">
<basemaps>
<layer label="电子地图" type="roadmap_cache" visible="true"
url="http://192.168.16.61:8088" icon="assets/images/basemap_streets.jpg"/>
<layer label="影像图" type="satellite_cache" visible="false"
url="http://192.168.16.61:8088" icon="assets/images/basemap_imagery.jpg"/>
<layer label="影像图" type="overlay_cache" visible="false"
url="http://192.168.16.61:8088" icon="assets/images/basemap_imagery_with_labels.png"/>
</basemaps>
<operationallayers>
<layer label="device_layer" type="graphic" visible="true"></layer>
<layer label="hotspot_layer" type="graphic" visible="true"></layer>
<layer label="policefence_layer" type="graphic" visible="true"></layer>
<layer label="policemobile_layer" type="graphic" visible="true"></layer>
<layer label="myplace_layer" type="graphic" visible="true"></layer>
<layer label="measure_layer" type="graphic" visible="true"></layer>
<layer label="measureGraphic_layer" type="graphic" visible="true"></layer>
<layer label="gxx_track_graphiclayer" type="graphic" visible="true"></layer>
<layer label="gxx_track_mark_graphiclayer" type="graphic" visible="true"></layer>
<layer label="gxx_realtime_graphiclayer" type="graphic" visible="true"></layer>
<layer label="gxx_realtime_mark_graphiclayer" type="graphic" visible="true"></layer>
</operationallayers>
</map>
<!-- widgets organized into widget containers that manage close/open etc -->
<!-- supported layout property options: horizontal(default)|float|vertical|fix-->
<widgetcontainer layout="float">
<widget label="书签" left="430" top="90"
icon="assets/images/i_bookmark.png"
config="widgets/Bookmark/BookmarkWidget.xml"
url="widgets/Bookmark/BookmarkWidget.swf"/>
<!-- <widget label="Draw" left="60" top="400" -->
<!-- icon="assets/images/i_draw2.png" -->
<!-- config="widgets/Draw/DrawWidget.xml" -->
<!-- url="widgets/Draw/DrawWidget.swf"/> -->
<!-- <widget label="Measure" left="60" top="400" -->
<!-- icon="assets/images/i_measure2.png" -->
<!-- config="widgets/Measure/MeasureWidget.xml" -->
<!-- url="widgets/Measure/MeasureWidget.swf"/> -->
<widget label="打印" left="400" top="100"
icon="assets/images/i_print.png"
config="widgets/Print/PrintWidget.xml"
url="widgets/Print/PrintWidget.swf"/>
<widget label="我的位置" left="480" top="220"
icon="assets/images/i_pin.png"
config="widgets/MyPlace/MyPlaceWidget.xml"
url="widgets/MyPlace/MyPlaceWidget.swf"/>
<widget label="轨迹回放" left="120" top="124"
icon="assets/images/i_track.png"
config="widgets/Track/HistoryTrackWidget.xml"
url="widgets/Track/HistoryTrackWidget.swf"/>
<widget label="实时轨迹" left="120" top="200"
preload="open"
icon="assets/images/i_measure2.png"
config="widgets/Track/RealTimeTrackWidget.xml"
url="widgets/Track/RealTimeTrackWidget.swf"/>
<widget label="设备编辑"
icon="assets/images/i_measure2.png"
config="widgets/DeviceEdit/DeviceEditWidget.xml"
url="widgets/DeviceEdit/DeviceEditWidget.swf"/>
</widgetcontainer>
</configuration>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
1 document.getElementById("${application}") //js 获取flex 对象
2 事件的发布与订阅
AppEvent.publish(AppEvent.WIDGET_CHANGE_STATE, data); //发布
AppEvent.addListener(AppEvent.DATA_PUBLISH, addData); //订阅
3 js 与 flex 间的相互调用
ExternalInterface.addCallback("drawPoliceCombatTrackOnMap",this.drawPoliceCombatTrackOnMapHandler); // 给js 提供的接口
document.getElementById("${application}").updateChnGPS(data); //调用其暴露出的接口
ExternalInterface.call(js_callback,data); //调用js 的函数
4 初始化一个业务组件
(1)js 初始化
配置文件配置widget,不直接初始化,由js 控制
var params = {
label:'我的位置'
};
flexObj.openWidget(params);
关闭
flexObj.closeWidget( {
label:"设备编辑"
});
(2)配置文件直接初始化
<widget label="实时轨迹" left="120" top="200"
preload="open"
icon="assets/images/i_measure2.png"
config="widgets/Track/RealTimeTrackWidget.xml"
url="widgets/Track/RealTimeTrackWidget.swf"/>
5 地图参数配置方法
(1) 直接配置config.xml
(2)从外部js 读取,外部js 从application.properties 获取。
function getInitMapParam(){
return {
gisServerInfo:{
username:"XXXX",
password:"xxxxx",
url:"http://172.16.16.107:8080/ningxiang",
tileType:"google"
}
6 as 文件使用
使用import 导入 ,类似java 初始化一个对象一样
7 mxml 文件的使用
(1)编译时添加为模块编译,使用openWidget 这种方法初始化
(2)在另外一个mxml 文件中作为标签使用
s:Group styleName="canvans" xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:mx="library://ns.adobe.com/flex/mx" width="340" height="230"
xmlns:control = "com.gosun.gis.frame.core.control.*"
implements="widgets.MyPlace.IMyPlaceContent">
<control:InfoWindowTemplete> 初始化InfoWindowTemplete.mxml
(3) var bayonetInfoContent:BayonetSpatialQueryContent = new BayonetSpatialQueryContent();
8 flex 提示框
Alert.show(info.toString(), wTemplate.widgetTitle);

7 107机器,109机器说明

172.16.16.107 账号 administrator 密码 123@456

用于下载地图底图,2种, 街道图 roadmap 和 卫星图 satellite
全能下载器,上面也有tomcat 可以用来部署测试地图底图

172.16.16.109 账号 administrator 密码 A123@456

跑着apache ,目前部门里的系统地图瓦片都是放在apache 里。E:map ,可以通过apche服务找到apche 目录里的httpd.conf 来确定appache 的文档更目录。

资源地址:AlivePDF和IDE 安装包可以上172.16.16.107 D:\交接 拷贝。